#ifndef NETWORKASSIST_H
#define NETWORKASSIST_H

#include "room_global.h"
#include <boost/noncopyable.hpp>

class Server;

class NetworkAssist :
        protected boost::noncopyable
{
public:
    NetworkAssist(Server &server);
    ~NetworkAssist();

    bool startNetwork();
    void stopNetwork();

    void close(unsigned long netKey);

    void sendData(unsigned long netKey, const void *data, int len);

protected:
    void onAccepted(unsigned long netKey,  int err);

    void onReadComplete(unsigned long netKey, size_t size, int err);

    void onWriteComplete(unsigned long netKey, size_t size, int err);

    size_t isReadComplete(size_t size);

    size_t isWriteComplete(size_t size);

private:
    Server &m_server;
};

#endif // NETWORKASSIST_H
